#pragma strict
var CameraObject : Transform;
var buttonColorTo : Color32;
var buttonColorFrom : Color32;
var colorSpeed : float;
var followSpeed : int;

function Start(){

	buttonColorTo = Color32(246,255,0,0);
	buttonColorFrom = Color32(150,150,150,0);	
	colorSpeed = 20;
	followSpeed = 4;
	
	renderer.material.SetColor("_Color", buttonColorFrom);

}

function Update() {

	transform.position.y = Mathf.MoveTowards(transform.position.y, CameraObject.position.y, followSpeed * Time.smoothDeltaTime);

}

function OnMouseEnter() {

	iTween.ColorTo(gameObject, buttonColorTo, colorSpeed * Time.deltaTime);

}

function OnMouseExit() {

	iTween.ColorTo(gameObject, buttonColorFrom, colorSpeed * Time.deltaTime);

}

function OnMouseDown() {
	var cameraOptions = GameObject.Find("opt_Options").GetComponent(Options);
	iTween.MoveTo(CameraObject.gameObject, Vector3(3.5,1.3,-0.2),cameraOptions.cameraMoveSpeed);
	iTween.RotateTo(CameraObject.gameObject, Vector3(15.7,346,1.2),cameraOptions.cameraMoveSpeed);
	
	var MenuOptions = CameraObject.GetComponent(MainCamera);
	MenuOptions.inOptions = false;

}